<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<link href="<%=basePath%>css/jquery-ui.min.css" rel="stylesheet">
<link href="<%=basePath%>css/jquery-ui.structure.min.css"
	rel="stylesheet">
<link href="<%=basePath%>css/jquery-ui.theme.min.css" rel="stylesheet">

<script type="text/javascript" src="<%=basePath%>js/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="<%=basePath%>js/jquery-ui.min.js"></script>
<script type="text/javascript" src="<%=basePath%>js/jquery.ui.datepicker-zh-TW.js"></script>
<script>
	 
	    $(document).ready(function() {
           console.log("robert.................");			
            $("#startDatepicker").datepicker();
			$("#endDatepicker").datepicker();
        });
		function popup1() {
			try {
			   var  url = "stackTracePatternMtn.html?keyCauseUid=" + $("#keyCauseUid").val();
				var dupes = $("#keyCauseUid option:selected").text();
				var dupes2 = $("#keyCauseUid").val();
				console.log(dupes);
				console.log(dupes2);
				console.log(url);

				window.open(url, "_blank",
						"scrollbars=1,resizable=1,height=500,width=1200");
			} catch (err) {
				console.log(err);
			}

		};
		function getval(sel) {
			console.log($('#keyCauseUid').selected);
			//alert(sel.value);
			var url = "stackTracePatternMtn.html?keyCauseUid=" + sel.value;
			console.log(url);
		} 
		
	</script>
</head>
<jsp:useBean id="stacTraceBo" class="bo.StacTraceBo" />
<jsp:useBean id="apBo" class="bo.ApBo" />
<c:set var="causeUidStrMap" value="${stacTraceBo.getCauseUidString() }"/>
<body>
<a href="<%=basePath%>index.jsp">[從主機點ip查詢stuck thread stacktrace]</a><br/>
	Stuck Thread Anaylsis.
	<br>
	<form action="stackTraceEventStatV2.html" method="post">
		<table>
			<tr>
				<td valign="top">stuck thread 原因: </td>
				<td>
					<c:forEach items="${stacTraceBo.findAll()}" var="vo">
						<input type="checkbox" name="keyCauseUid" value="${vo['uid']}">${vo['uid']}. ${vo['keyCause']}<br>
					</c:forEach>
				 </td>
			</tr>
			<tr>
				<td>日期起始日期:</td>
				<td><input type="text" name="startDate" id="startDatepicker" value="${requestScope.startDate}" /></td>				
				<td></td>
			</tr>
			<tr>
				<td>日期結束日期:</td>
				<td><input type="text" name="endDate" id="endDatepicker"  value="${requestScope.endDate}" /></td>
				<td></td>
			</tr>
			<tr>
				<td><input type="submit" /></td>
				<td></td>
			</tr>
		</table>
	</form>
	<table border="1">
			<tr>
				<th>ip</th>
				<c:forEach items="${requestScope.keyCauseUidStackTraceStatMap}" var="causeUid">
								<th>${causeUidStrMap[causeUid.key]}</th>		
				</c:forEach>
			</tr>
		<c:forEach items="${apBo['allApIp']}" var="ip">			
			<tr>
				<td>${ip}</td>
				<c:forEach items="${requestScope.keyCauseUidStackTraceStatMap}" var="causeUid">					
					<td>${causeUid.value[ip]}</td>
				</c:forEach>				
			</tr>
		</c:forEach>
	</table>
</body>
</html>
